<?php

class RL_Principal_Auth_LoginPassword extends RL_Principal_Auth_Common
{
	public $error = NULL;
	public function __construct ($args)
	{
		$this->store = $args['store'];
		$this->realm = isset($args['realm']) ? $args['realm'] : NULL;
	} // end of __construct
	public function identify ($input)
	{
		$this->cred = NULL;

		$login    = $input->login;
		$password = $input->password;

		if ($data = $this->store->loadByLogin($login, $this->realm)) {
			if (!empty($data['password']) // не разрешаем пустые пароли
				/*&& $data['password'] === $password*/) {
				$this->cred = $data;
			}
		}

		return $this->cred;
	} // end of function identify
	public function getProfile ($cred)
	{
		return $this->cred;
	} // end of function getProfile
}

